Sometimes defects caused by disconnection of a data line or a gate line, a short circuit, a failure of a transistor, and the like may be generated in a display device manufacturing process. Conventionally, a technique of detecting the defect in the manufacturing process has been proposed. For example, in a technique disclosed in Unexamined Japanese Patent Publication No. 2005-345547, image data is written in a pixel, a transistor is turned off, any voltage is applied to the data line to bring the data line into a high impedance state, and the transistor is turned on to detect a change in potential of the data line, whereby the defects in a substrate is inspected.